(DEFUN C:SURFACEDATA ()
  (vl-load-com)
  (setq it(nentselp))
  (IF (AND it (setq ename (car it)))
    NIL
    (setq ename (entlast))
  )
  (setq anobj (vlax-ename->vla-object ename)) ; for inspecting a selection
  (IF (EQ (vlax-get-property anobj 'ObjectName) "AeccDbSurfaceTin")
    (PROGN
      (PRINC (STRCAT "\n" (vlax-get-property anobj 'ObjectName) " was selected! "))
      (SETQ this-surface-style (vlax-get-property anobj 'Style))
      (SETQ this-contour-style (vlax-get-property this-surface-style 'ContourStyle))
      (SETQ this-mjcdsm (vlax-get-property this-contour-style 'MajorContourDisplayStyleModel))
      (SETQ this-mjcdsm-color (vlax-get-property this-mjcdsm 'Color))
      (SETQ this-mjcdsm-layer (vlax-get-property this-mjcdsm 'Layer))
      (SETQ this-mjcdsm-ltype (vlax-get-property this-mjcdsm 'Linetype))
      (SETQ this-mjcdsp (vlax-get-property this-contour-style 'MajorContourDisplayStylePlan))
      (SETQ this-mjcdsp-color (vlax-get-property this-mjcdsp 'Color))
      (SETQ this-mjcdsp-layer (vlax-get-property this-mjcdsp 'Layer))
      (SETQ this-mjcdsp-ltype (vlax-get-property this-mjcdsp 'Linetype))
      (SETQ this-mncdsm (vlax-get-property this-contour-style 'MinorContourDisplayStyleModel))
      (SETQ this-mncdsm-color (vlax-get-property this-mncdsm 'Color))
      (SETQ this-mncdsm-layer (vlax-get-property this-mncdsm 'Layer))
      (SETQ this-mncdsm-ltype (vlax-get-property this-mncdsm 'Linetype))
      (SETQ this-mncdsp (vlax-get-property this-contour-style 'MinorContourDisplayStylePlan))
      (SETQ this-mncdsp-color (vlax-get-property this-mncdsp 'Color))
      (SETQ this-mncdsp-layer (vlax-get-property this-mncdsp 'Layer))
      (SETQ this-mncdsp-ltype (vlax-get-property this-mncdsp 'Linetype))
      (IF ukword NIL (LOAD "ukword" "\nFile UKWORD.LSP not loaded! "))
      (IF uint NIL (LOAD "uint" "\nFile UINT.LSP not loaded! "))
  (SETQ curltyp_lst (LIST (STRCASE (CDR (ASSOC 2 (TBLNEXT "ltype" T))) T)))
  (WHILE (SETQ nxtltyp (TBLNEXT "ltype"))
    (IF (NOT (WCMATCH (CDR (ASSOC 2 nxtltyp)) "*|*"))
      (SETQ curltyp_lst (APPEND curltyp_lst (LIST (STRCASE (CDR (ASSOC 2 nxtltyp)) T))))
    )
  )
  (foreach n curltyp_lst
    (setq curltyp_lst
           (subst (strcat (strcase (substr n 1 1)) (substr n 2))
                  n
                  curltyp_lst
           )
    )
  )
  (setq newltyp_lst curltyp_lst)
  (setq cnt 0)
  (while (< cnt (length curltyp_lst))
    (foreach n (append (reverse (cdr (member (nth cnt curltyp_lst)(reverse curltyp_lst))))(cdr(member (nth cnt curltyp_lst) curltyp_lst)))
      (setq chrcnt 1)
      (while (and
               (wcmatch (substr (nth cnt curltyp_lst) 1 chrcnt) (substr n 1 chrcnt))
               (< chrcnt (strlen n))
               (< chrcnt (strlen (nth cnt curltyp_lst)))
             )
        (setq chrcnt (1+ chrcnt))
        (setq newltyp_lst (subst
                            (strcat (strcase (substr (nth cnt newltyp_lst) 1 chrcnt))(substr (nth cnt newltyp_lst) (1+ chrcnt)))
                            (nth cnt newltyp_lst)
                            newltyp_lst
                          )
        )
        (setq newltyp_lst (subst
                            (strcat (strcase (substr n 1 chrcnt))(substr n (1+ chrcnt)))
                            (CAR (MEMBER (strcase n t) newltyp_lst))
                            newltyp_lst
                          )
        )
      )
    )
    (setq cnt (1+ cnt))
  )
      (SETQ newltyp_lst (ACAD_STRLSORT newltyp_lst))
      (SETQ kword-str (EVAL (CONS 'STRCAT (MAPCAR '(LAMBDA (x) (STRCAT x " ")) newltyp_lst))))
      (SETQ kword-str (STRCAT kword-str "Unchanged"))
      (SETQ option-str (EVAL (CONS 'STRCAT (MAPCAR '(LAMBDA (x) (STRCAT x "/")) newltyp_lst))))
      (SETQ option-str (STRCAT "[" option-str "Unchanged]"))
      (IF (AND
            (EQ this-mjcdsm-color 256)
            (WCMATCH this-mjcdsm-ltype "ByLayer")
          )
          (PROGN
            (PRINC (STRCAT "\nChanges made to Color and Linetype of " this-mjcdsm-layer " WILL affect this surface style's major contour model display! "))
            (SETQ change-mjm-clt (ukword 1 "Yes No" (STRCAT "Do you want to change the color and linetype of " this-mjcdsp-layer "? [Yes/No]") (IF change-mjm-clt change-mjm-clt "No")))
            (IF (EQ change-mjm-clt "Yes")
              (PROGN
                (SETQ newmjm-ltype (ukword 1 kword-str (STRCAT "New " this-mjcdsp-layer " Linetype " option-str) (IF newmjm-ltype newmjm-ltype "Unchanged")))
                (WHILE (AND (NOT (EQ newmjm-color "Unchanged"))(OR (< newmjm-color 1)(> newmjm-color 255)))
                  (SETQ newmjm-color (uint 1 "Unchanged" (STRCAT "New " this-mjcdsp-layer " color")(IF mjm-color mjm-color)))
                  (IF (EQ (TYPE newmjm-color) 'INT)
                    (SETQ mjm-color newmjm-color)
                  )
                )
                (IF (NOT (WCMATCH (STRCASE newmjm-ltype) "UNCHANGED"))
                  (PROGN
                    (SETQ this-layename (TBLOBJNAME "LAYER" this-mjcdsm-layer))
                    (SETQ this-layent (ENTGET this-layename))
                    (SETQ this-layent (SUBST (CONS 6 newmjm-ltype)(ASSOC 6 this-layent) this-layent))
                    (ENTMOD this-layent)
                    (ENTUPD this-layename)
                  )
                )
                (IF (NOT (EQ (TYPE newmjm-color) 'STR))
                  (PROGN
                    (SETQ this-layename (TBLOBJNAME "LAYER" this-mjcdsm-layer))
                    (SETQ this-layent (ENTGET this-layename))
                    (SETQ this-layent (SUBST (CONS 62 newmjm-color)(ASSOC 62 this-layent) this-layent))
                    (ENTMOD this-layent)
                    (ENTUPD this-layename)
                  )
                )
                (SETQ newmjm-color NIL)
              )
            )
          )
          (IF (EQ this-mjcdsm-color 256)
            (PROGN
              (PRINC (STRCAT "\nColor changes made to " this-mjcdsm-layer " WILL affect the Color of this surface style's major contour plan display! "))
              (PRINC (STRCAT "\nLinetype changes made to " this-mjcdsm-layer " WILL NOT affect the Linetype of this surface style's major contour plan display! "))
            )
            (PROGN
              (PRINC (STRCAT "\nColor changes made to " this-mjcdsm-layer " WILL NOT affect the Color of this surface style's major contour model display! "))
              (PRINC (STRCAT "\nLinetype changes made to " this-mjcdsm-layer " WILL affect the Linetype of this surface style's major contour model display! "))
            )
          )
      )
      (IF (AND
            (EQ this-mncdsm-color 256)
            (EQ this-mncdsm-ltype "ByLayer")
          )
          (PROGN
            (PRINC (STRCAT "\nChanges made to Color and Linetype of " this-mjcdsm-layer " WILL affect this surface style's minor contour model display! "))
            (IF (EQ change-mjm-clt "Yes")
              (SETQ change-mnm-clt "Yes")
              (SETQ change-mnm-clt (ukword 1 "Yes No" (STRCAT "Do you want to change the color and linetype of " this-mncdsp-layer "? [Yes/No]") (IF change-mnm-clt change-mnm-clt "No")))
            )
            (IF (EQ change-mnm-clt "Yes")
              (PROGN
                (SETQ newmnm-ltype (ukword 1 kword-str (STRCAT "New " this-mncdsp-layer " Linetype " option-str) (IF newmnm-ltype newmnm-ltype "Unchanged")))
                (WHILE (AND (NOT (EQ newmnm-color "Unchanged"))(OR (< newmnm-color 1)(> newmnm-color 255)))
                  (SETQ newmnm-color (uint 1 "Unchanged" (STRCAT "New " this-mncdsp-layer " color") (IF mnm-color mnm-color)))
                  (IF (EQ (TYPE newmnm-color) 'INT)
                    (SETQ mnm-color newmnm-color)
                  )
                )
                (IF (NOT (WCMATCH (STRCASE newmnm-ltype) "UNCHANGED"))
                  (PROGN
                    (SETQ this-layename (TBLOBJNAME "LAYER" this-mncdsm-layer))
                    (SETQ this-layent (ENTGET this-layename))
                    (SETQ this-layent (SUBST (CONS 6 newmnm-ltype)(ASSOC 6 this-layent) this-layent))
                    (ENTMOD this-layent)
                    (ENTUPD this-layename)
                  )
                )
                (IF (NOT (EQ (TYPE newmnm-color) 'STR))
                  (PROGN
                    (SETQ this-layename (TBLOBJNAME "LAYER" this-mncdsm-layer))
                    (SETQ this-layent (ENTGET this-layename))
                    (SETQ this-layent (SUBST (CONS 62 newmnm-color)(ASSOC 62 this-layent) this-layent))
                    (ENTMOD this-layent)
                    (ENTUPD this-layename)
                  )
                )
                (SETQ newmnm-color NIL)
              )
            )
          )
          (IF (EQ this-mncdsm-color 256)
            (PROGN
              (PRINC (STRCAT "\nColor changes made to " this-mncdsm-layer " WILL affect the Color of this surface style's major contour plan display! "))
              (PRINC (STRCAT "\nLinetype changes made to " this-mncdsm-layer " WILL NOT affect the Linetype of this surface style's major contour plan display! "))
            )
            (PROGN
              (PRINC (STRCAT "\nColor changes made to " this-mncdsm-layer " WILL NOT affect the Color of this surface style's major contour model display! "))
              (PRINC (STRCAT "\nLinetype changes made to " this-mncdsm-layer " WILL affect the Linetype of this surface style's major contour model display! "))
            )
          )
      )
      (IF (AND
            (EQ this-mjcdsp-color 256)
            (EQ this-mjcdsp-ltype "ByLayer")
          )
          (PRINC (STRCAT "\nChanges made to Color and Linetype of " this-mjcdsp-layer " WILL affect this surface style's major contour plan display! "))
          (IF (EQ this-mjcdsp-color 256)
            (PROGN
              (PRINC (STRCAT "\nColor changes made to " this-mjcdsp-layer " WILL affect the Color of this surface style's major contour plan display! "))
              (PRINC (STRCAT "\nLinetype changes made to " this-mjcdsp-layer " WILL NOT affect the Linetype of this surface style's major contour plan display! "))
            )
            (PROGN
              (PRINC (STRCAT "\nColor changes made to " this-mjcdsp-layer " WILL NOT affect the Color of this surface style's major contour plan display! "))
              (PRINC (STRCAT "\nLinetype changes made to " this-mjcdsp-layer " WILL affect the Linetype of this surface style's major contour plan display! "))
            )
          )
      )
      (IF (AND
            (EQ this-mncdsp-color 256)
            (EQ this-mncdsp-ltype "ByLayer")
          )
          (PRINC (STRCAT "\nChanges made to Color and Linetype of " this-mjcdsm-layer " WILL affect this surface style's minor contour plan display! "))
          (IF (EQ this-mncdsp-color 256)
            (PROGN
              (PRINC (STRCAT "\nColor changes made to " this-mncdsp-layer " WILL affect the Color of this surface style's major contour plan display! "))
              (PRINC (STRCAT "\nLinetype changes made to " this-mncdsp-layer " WILL NOT affect the Linetype of this surface style's major contour plan display! "))
            )
            (PROGN
              (PRINC (STRCAT "\nColor changes made to " this-mncdsp-layer " WILL NOT affect the Color of this surface style's major contour plan display! "))
              (PRINC (STRCAT "\nLinetype changes made to " this-mncdsp-layer " WILL affect the Linetype of this surface style's major contour plan display! "))
            )
          )
      )
    )
    (PRINC (STRCAT "\n" (vlax-get-property anobj 'ObjectName) " was selected! "))
  )
  (PRINC)
)
(DEFUN optioncase (opstr / )
  (IF DOS_STRTOKENS
    (PROGN
      (SETQ str_lst (DOS_STRTOKENS opstr " "))
      (SETQ str_word_lst (MAPCAR '(LAMBDA (x) (LIST (STRCASE (SUBSTR x 1 1) nil)(STRCASE (SUBSTR x 2) T))) str_lst))
      (SETQ title_word_lst (MAPCAR '(LAMBDA (x) (EVAL (APPEND (LIST 'STRCAT) x (LIST " ")))) str_word_lst))
      (SETQ title_word_lst (SUBST (SUBSTR (LAST title_word_lst) 1 (1- (STRLEN (LAST title_word_lst))))(LAST title_word_lst)title_word_lst))
      (SETQ new_opstr (EVAL (CONS 'STRCAT title_word_lst)))
      (IF new-option-list
        (SETQ new-option-list (APPEND new-option-list (LIST new_opstr)))
        (SETQ new-option-list (LIST new_opstr))
      )
    )
  )
)
